<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
	  xmlns:ui="http://java.sun.com/jsf/facelets"
	  xmlns:p="http://primefaces.org/ui"
	  xmlns:f="http://java.sun.com/jsf/core"
	  xmlns:composite="http://xmlns.jcp.org/jsf/composite">

	<composite:interface>
		<composite:attribute name="axis" required="true" type="org.plotfaces.model.Axis"/>
		<composite:attribute name="collapseHandler" required="true" type="org.plotfacesdemo.CollapseHandler"/>
		<composite:attribute name="plot" required="true" type="java.lang.String"/>
	</composite:interface>

    <composite:implementation>
		<!--
			All message resources should have the _axisPadding suffix.
		-->
		<p:panel id="axisPadding" closable="false" toggleable="true" collapsed="#{not cc.attrs.collapseHandler.isVisible('axisPadding')}" header="#{msg.padding}">
			<p:ajax event="toggle" listener="#{cc.attrs.collapseHandler.handleToggle}" />
			<p:panelGrid id="axisPaddingGrid" columns="3">
				<h:panelGroup>
					#{msg.padding_axisPadding}
				</h:panelGroup>
				<h:panelGroup>
					<p:inputText value="#{cc.attrs.axis.pad}" rendered="#{cc.attrs.axis.pad != null}">
						<p:ajax update="#{cc.attrs.plot}"/>
						<f:convertNumber/>
					</p:inputText>

					<p:commandButton value="#{msg.initialize}" action="#{cc.attrs.axis.setPad( 1.2 )}" rendered="#{cc.attrs.axis.pad == null}" update="axisPaddingGrid #{cc.attrs.plot}"/>
					<p:commandButton value="#{msg.reset}" rendered="#{cc.attrs.axis.pad != null}" update="axisPaddingGrid #{cc.attrs.plot}" immediate="true">
						<f:setPropertyActionListener target="#{cc.attrs.axis.pad}" value="#{null}" />
					</p:commandButton>
				</h:panelGroup>
				<h:panelGroup>
					#{msg.padding_axisPadding_notes}
				</h:panelGroup>

				<h:panelGroup>
					#{msg.paddingMinimum_axisPadding}
				</h:panelGroup>
				<h:panelGroup>
					<p:inputText value="#{cc.attrs.axis.padMin}" rendered="#{cc.attrs.axis.padMin != null}">
						<p:ajax update="#{cc.attrs.plot}"/>
						<f:convertNumber/>
					</p:inputText>

					<p:commandButton value="#{msg.initialize}" action="#{cc.attrs.axis.setPadMin( 1.2 )}" rendered="#{cc.attrs.axis.padMin == null}" update="axisPaddingGrid #{cc.attrs.plot}"/>
					<p:commandButton value="#{msg.reset}" rendered="#{cc.attrs.axis.padMin != null}" update="axisPaddingGrid #{cc.attrs.plot}" immediate="true">
						<f:setPropertyActionListener target="#{cc.attrs.axis.padMin}" value="#{null}" />
					</p:commandButton>
				</h:panelGroup>
				<h:panelGroup>
					#{msg.paddingMinimum_axisPadding_notes}
				</h:panelGroup>

				<h:panelGroup>
					#{msg.paddingMaximum_axisPadding}
				</h:panelGroup>
				<h:panelGroup>
					<p:inputText value="#{cc.attrs.axis.padMax}" rendered="#{cc.attrs.axis.padMax != null}">
						<p:ajax update="#{cc.attrs.plot}"/>
						<f:convertNumber/>
					</p:inputText>

					<p:commandButton value="#{msg.initialize}" action="#{cc.attrs.axis.setPadMax( 1.2 )}" rendered="#{cc.attrs.axis.padMax == null}" update="axisPaddingGrid #{cc.attrs.plot}"/>
					<p:commandButton value="#{msg.reset}" rendered="#{cc.attrs.axis.padMax != null}" update="axisPaddingGrid #{cc.attrs.plot}" immediate="true">
						<f:setPropertyActionListener target="#{cc.attrs.axis.padMax}" value="#{null}" />
					</p:commandButton>
				</h:panelGroup>
				<h:panelGroup>
					#{msg.paddingMaximum_axisPadding_notes}
				</h:panelGroup>
			</p:panelGrid>
		</p:panel>
	</composite:implementation>
</html>

